package com.wenhao.newcode.pinduoduo.hard2021;

import java.util.Scanner;

/**
 * @author Wenhao Tong
 * @create 2021-07-25 12:52
 */
public class Main3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int M = scanner.nextInt();
        int[] Ai = new int[N];
        for (int i = 0;i < N;i++) {
            Ai[i] = scanner.nextInt();
        }
        int count = 0;
        for (int i = 0;i < N;i++) {
            int sum = 0;
            for (int j = i;j < N;j++) {
                sum += Ai[j] % M;
                if (sum % M == 0) {
                    count++;
                }
            }
        }
        System.out.println(count);
    }
}
